home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
c
/
vbccppc.lha
/
vbcc
/
doc
/
pasm.doc
< prev
next >
Wrap
Text File
|
1999-03-07
|
45KB
|
2,191 lines
pasm V1.2 VBCC ANSI C Compiler Reference Manual pasm V1.2
NAME
pasm - PowerPC assembler
SYNOPSIS
pasm [-mwxRVX] [-B address] [-D symbol[=value]] [-F format]
[-I include-path] [-O opt-level] [-o filename] source-file
DESCRIPTION
pasm is a 32/64-bit PowerPC assembler and its usual task is to
assemble the output of the vbcc C compiler. It supports macros
and include files, so it could also be used for direct PowerPC
program development.
pasm uses the same syntax as Motorola's PAS assembler or the
PPC-port of the GNU assembler.
All PowerPC standard instructions are supported: User level-,
supervisor level-, optional-, 32-bit and 64-bit instructions.
Additionally, there is a huge set of extended mnemonics as proposed
in the "PowerPC Programming Environments" from IBM and Motorola.
The options are as follows:
-B address
Sets the base address for absolute output format.
-D symbol[=value]
Defines a symbol. Its value defaults to '1'.
-F format
Sets the output file format:
0: Absolute, raw format. Base address defaults to
zero, but may be changed by "-B addr".
1: ELF-32bit-PowerPC object.
2: EHF object. Only used under AmigaOS with WarpOS
extension from Haage&Partner.
3: ADOS object. The difference between ADOS and and EHF
is, that ADOS uses HUNK_CODE instead HUNK_PPC_CODE
and doesn't support any PPC-specific relocations and
reference types. This makes it possible to link
simple PowerPC programs with an old linker, like
BLink, SLink or PhxLnk.
-I include-path
Adds another include file path. Example:
-IWork:PPCIncludes or -I /usr/local/include
-m64 Enable 64-bit instructions.
-ms Enable supervisor instructions.
-mo Enable optional instructions.
-O opt-level
Sets optimization level. The level contains 32 flags to
enable different optimizations and features. Currently,
the following are used:
0x00010000: Automatic correction of far branches. A
"Bcc label" with label out of range (more
than 32764 bytes away) will be converted
into a "B!cc $+8 / B label" combination.
-o filename
Specifies the name of the output file. If not given, pasm
will use the name of the source text and replaces the
extension by ".o".
-R Don't predefine register symbols r0-r31, f0-f31, cr0-c7,
xer, eq, etc.
-V Prints version identification and build string. Example:
pasm V0.69 (Amiga OS/M68k) (c)1997-98 by Frank Wille
build date: Jan 2 1998, 11:51:47
-w Suppress all warning messages.
-x Undefined symbols are automatically defined as external
symbols.
-X No extended mnemonics. This means you will have to write
"bc 12,2,label" instead "beq label". All predefined extened
mnemonics are listed in the section EXTENDED MNEMONICS.
GENERAL FORMAT
Source texts in the following format will be accepted by pasm:
[<label>] [<opcode> [<operand>[,<operand>,...]]]
The opcode field may start at the first column, because pasm requires
all labels to be terminated by a ':'. Opcodes are directives, macros
and PowerPC instructions.
These statements are separated by a line feed (0xa) or a ';' character.
Theoretically, you can write your whole program in a single line.
Example:
.text;.global start;start: li r3,0;blr
Comments are introduced by a '#':
# This is a comment
nop # another comment
SNYTAX
Supported operators in expressions:
Unary (highest priority):
+ positive
- negate
~ not
Binary (priority):
+ addition (4)
- subtraction (4)
* multiplication (5)
/ division (5)
% modulo (5)
<< shift left (3)
>> shift right (3)
& and (2)
| or (0)
^ exclusive or (1)
Supported constants:
1234 decimal
01234 octal
0x1234 hexadecimal
0b1010 binary
"abcd" string
ELF relocation suffix:
Syntax: <expression>@<reloc type>
@l low half word (R_PPC_ADDR16_LO)
@h high half word (R_PPC_ADDR16_HI)
@ha high half word for addition (R_PPC_ADDR16_HA)
@sdax base relative section offset (R_PPC_SDAREL16)
@sdarx base relative section offset (R_PPC_SDAREL16)
DIRECTIVES
.ascii <exp1>[,<exp2>,"<string1>"...]
----------------------------------
See ".byte".
.asciiz "<string1>"[,"<string2>"...]
------------------------------------
See ".string".
.align <bit_count>
------------------
Insert as much zero bytes as required to reach an address where
<bit_count> low order bits are zero. For example ".align 2" would
make an alignment to the next 32-bit boundary.
.baserel <section>,<base_reg>
-----------------------------
Allow base relative access via register <base_reg> in the section
called <section>. In absolute mode, <base_reg> must be initialized
with an address pointing 32764 bytes behind the start address of
this section. In EHF, <base_reg> must be initialized with the linker
symbol _LinkerDB. By default, base relative access via r2 (rtoc)
on the section ".tocd" is set.
** This directive is obsolete, since pasm V1.1! **
pasm can access multiple small data sections using the .sdreg
directive now. .baserel may be useful, when creating an
absolute output file, though.
.bss <symbol>,<size>[,<alignment>]
----------------------------------
Allocate <size> bytes of space in the .bss section and assign
the value to that location to <symbol>. If <alignment> is given,
then the space will be aligned to an address having <alignment>
low zero bits or 2, whichever is greater.
<symbol> may be made globally visible by the .globl directive.
.byte <exp1>[,<exp2>,"<string1>"...]
------------------------------------
Assign the integer or string constant operands into successive
bytes of memory in the current section. Any combination of integer
and character string constant operands is permitted.
.comm <symbol>,<size>
---------------------
Allocate <size> bytes of space in the .bss section and assign
the value to that location to <symbol>. <symbol> is always made
globally visible. ".comm"-areas of less than 8 bytes in size are
aligned to word boundaries, otherwise to doubleword boundaries.
.double <float1>[,<float2>...]
------------------------------
If the current section location counter is not on a doubleword
boundary advance it to the next doubleword boundary. Then assign
the values of the operands as IEEE 754 double-precision 64-bit
format numbers to successive doublewords of memory in the current
section.
.else
-----
Begins the "else"-part in a block of conditional assembly.
.endif
------
Ends a block of conditional assembly.
.endm
-----
Ends a macro definition.
.extern <symbol>
----------------
See ".globl".
.fail
-----
Abort assembly with displaying the error message "fail directive
encountered".
.file "<file name>"
-------------------
Specify the source file name, w